﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>中文日期样式(一)</title>
    <script language="javascript">
        function number(index1)
        {
//定义中文数值的显示
            var numberstring="一二三四五六七八九十";
            if(index1 ==0) {document.write("十")}
            if(index1 < 10){
                document.write(numberstring.substring(0+(index1-1),index1))}
            else if(index1 < 20 ){
                document.write("十"+numberstring.substring(0+(index1-11),(index1-10)))}
            else if(index1 < 30 ){
                document.write("二十"+numberstring.substring(0+(index1-21),(index1-20)))}
            else{
                document.write("三十"+numberstring.substring(0+(index1-31),(index1-30)))}
        }
        var today1 = new Date();//获取当前日期
        var month = today1.getMonth()+1;
        var date = today1.getDate();
        var day = today1.getDay();
        document.write("<br><strong><small><center>")
        document.write("二零零七年");
        number(month);   //将月份转换为中文
        document.write("月");
        number(date);   //将日转换为中文
        document.write("日</small><center>")
    </script>
</head>
<body>

</body>
</html>